/**
 * File    : OpenIDAuthResponse.java
 * Created : 2008-10-5
 * By      : LuHuiguo
 */
package com.luhuiguo.sso.provider;

import java.util.HashMap;
import java.util.Map;

/**
 * @author LuHuiguo
 * @version $Id: OpenIDAuthResponse.java 7 2008-10-06 03:46:38Z LuHuiguo $
 * 
 */
public class OpenIDAuthResponse {

	private String identifier;
	private String claimedIdentifier;
	private Map<String,String> attributes;
	private boolean authenticated;

	public OpenIDAuthResponse(String identifier, boolean authenticated) {
		this.identifier = identifier;
		claimedIdentifier = identifier;
		this.authenticated = authenticated;
	}

	public String getIdentifier() {
		return identifier;
	}

	public void setIdentifier(String identifier) {
		this.identifier = identifier;
	}

	public String getClaimedIdentifier() {
		return claimedIdentifier;
	}

	public void setClaimedIdentifier(String claimedIdentifier) {
		this.claimedIdentifier = claimedIdentifier;
	}

	public Map<String,String> getAttributes() {
		return attributes;
	}

	public void setAttributes(Map<String,String> attributes) {
		this.attributes = attributes;
	}

	public boolean isAuthenticated() {
		return authenticated;
	}

	public void setAuthenticated(boolean authenticated) {
		this.authenticated = authenticated;
	}

	public void addAttribute(String name, String value) {
		if (attributes == null)
			attributes = new HashMap<String,String>();
		attributes.put(name, value);
	}

	public boolean hasAttributes() {
		return attributes != null && attributes.size() > 0;
	}

}
